#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e7;
int T,n,m,L,V;
int cnt,cnt2;
int read(){
    int x=0;char c=getchar();int f=1;
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(; isdigit(c);c=getchar()) x=(x<<3) + (x<<1) + (c^48);
    return x*f;
}

struct car
{
    bool ok;
    double d;
    double v;
    double a;
   // bool cs[100005];
} c[MAXN];

int road[MAXN];
int cs[1005][1005];
int cop[1005];
int cnt1;
void dfs(int i)
{
    if(i==n+1)
    {
        for(int j=1;j<=m;j++)
        {
            if(cop[j]==0) cnt1++;
        }
        cnt2=max(cnt1,cnt2);
    }
    else{
        if(cs[i][0]==1)
        {
            for(int j=1;j<=m;j++)
            {
                if(cs[i][j]==1)
                {
                    cop[j]=1;
                    dfs(i+1);
                    cop[j]=0;
                }
                else continue;
            }
        }
    }
}


int main()
{
    freopen("detest.in","r",stdin);
    freopen("detest.out","w",stdout);
    T=read();
    n=read(); m=read();L=read();V=read();
    for(int i=1;i<=n;i++){c[i].d=read();c[i].v=read();c[i].a=read();}
    for(int i=1;i<=m;i++){road[i]=read();}

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            double t=(-c[i].v+sqrt(c[i].v*c[i].v+2*c[i].a*(road[j]-c[i].d)))/c[i].a;
            if(c[i].v+c[i].a*t>V ) {c[i].ok=1; cs[i][j]=1;}
        }
        if (c[i].ok) cnt++;
    }
    dfs(1);
    cout<<cnt<<" "<<cnt2;
}
//T? L?
/*
1
 5 5 15 3
 0 3 0
 12 4 0
 1 1 4
 5 5 ‐2
 6 4 ‐4
 2 5 8 9 15
*/
